package entity

import (
	"time"

	"gorm.io/gorm"
	"shqsoft.cn/pas3ui/base"
)

//IndiAccoFlowChUpdate
type IndiAccoFlowChUpdate struct {
	ACID    int             `gorm:"column:ACID;primary_key;"`
	CUID    int             `gorm:"column:CUID"`
	CUNM    string          `gorm:"column:CUNM"`
	UTNM    string          `gorm:"column:UTNM"`
	ITNM    string          `gorm:"column:ITNM"`
	OPDT    time.Time       `gorm:"column:OPDT"`
	ACNO    string          `gorm:"column:ACNO"`
	BANO    string          `gorm:"column:BANO"`
	ISDIVI  int             `gorm:"column:ISDIVI"`
	IDNO    string          `gorm:"column:IDNO"`
	CDNO    string          `gorm:"column:CDNO"`
	CYNM    string          `gorm:"column:CYNM"`
	CLDT    time.Time       `gorm:"column:CLDT"`
	ACBL    float64         `gorm:"column:ACBL"`
	Bgqdivi []base.DiviDesc `gorm:"-" json:"Bgqdivi"`
}

//TableName
func (IndiAccoFlowChUpdate) TableName() string {
	return "V_INDI_ACCO_FLOW_UPDATE"
}
func (i *IndiAccoFlowChUpdate) AfterFind(tx *gorm.DB) (err error) {
	i.IDNO = base.IndoTM(i.IDNO)
	i.ACNO = base.AcnoTM(i.ACNO)
	i.BANO = base.AcnoTM(i.BANO)
	i.CDNO = base.CdnoTM(i.CDNO)
	d, err := base.GetDiviMap(base.IndiSave, i.ACID)
	if err != nil {
		return err
	}
	i.Bgqdivi, err = d.GetDesc()
	return
}
func IndiAccoFlowChUpdateEF() base.EntityFunc {
	return func() interface{} {
		entity := IndiAccoFlowChUpdate{}
		return &entity
	}
}
func IndiAccoFlowChUpdateESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []IndiAccoFlowChUpdate
		return &entities
	}
}

func init() {
	base.DaoPoolObj.Put("IndiAccoFlowChUpdate", base.NewDefaultDao(IndiAccoFlowChUpdateEF(), IndiAccoFlowChUpdateESF(), nil, "ch"))
}
